package com.luyidog.swaggerdemo.controller;

import com.luyidog.swaggerdemo.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;


@RestController //声明所有Controller返回json格式，可以直接编写返回接口
public class HelloController {
    @GetMapping(value = "/hello")
    public String hello(@ApiParam("用户名") String username) {
        return "hello" + username;
    }

    @ApiOperation("Hello控制类")//放到接口方法上，接口注释文档
    @PostMapping(value = "/user")
    public String user(@ApiParam("用户") @RequestBody User username) {
        return "test:" + username;
    }
}
